package com.kpmg.datalake.web.config;

import com.github.pagehelper.PageHelper;
import com.kpmg.datalake.web.interceptor.PageInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;



/**
 * 分页配置
 * @author Tony
 */
@Configuration
public class PageHelperConfiguration {
    @Bean
    public PageInterceptor pageInterceptor() {
        PageInterceptor interceptor = new PageInterceptor();
        interceptor.setProperties(new Properties());
        return interceptor;
    }


	@Bean
	public PageHelper pageHelper() {
        PageHelper page = new PageHelper();
		Properties p = new Properties();
		p.setProperty("offsetAsPageNum", "true");
		p.setProperty("rowBoundsWithCount", "true");
		p.setProperty("reasonable", "true");
		page.setProperties(p);
		return page;
	}
}
